#include "Drawing.h"
#include <QDebug>
#include <QString>
#include "Logger.h"

void Drawing::draw(QPainter*)
{

}

QList<QPoint*> Drawing::vertexs() const
{
    return m_vertexs;
}
void Drawing::setVertexs(QList<QPoint*> vertexs)
{
    m_vertexs = vertexs;
}

QList<QColor*> Drawing::colors() const
{
    return m_colors;
}

void Drawing::setColors(QList<QColor*> colors)
{
    m_colors = colors;
}

QVector2D Drawing::generateVector(QPoint p1,QPoint p2)
{
    QVector2D v;

    v.setX(p2.x() - p1.x());
    v.setY(p2.y() - p1.y());

    return v;
}

QVector2D Drawing::projectFromZeroUpToOne(QVector2D v1, QVector2D v2)
{
    qreal module = ((QVector2D::dotProduct(v1,v2))/(QVector2D::dotProduct(v2,v2)));

    if(module < 0) return (0 * v2);
    if(module > 1.0) return v2;
    return (module * v2);
}

bool Drawing::pointLessThan(QPoint* p1 ,QPoint* p2)
{
    return ((p1->x() < p2->x()) || (p1->x() == p2->x() && p1->y() > p2->y()));
}

bool Drawing::wired()
{
    return m_wired;
}

void Drawing::setWired(bool wired)
{
    m_wired = wired;
}

bool Drawing::filled()
{
    return m_filled;
}

void Drawing::setFilled(bool filled)
{
    m_filled = filled;
}

Texture* Drawing::texture()
{
    return m_texture;
}

void Drawing::setTexture(Texture* texture)
{
    m_texture = texture;
}
